'''
utils/message.py
消息模块
返回状态码

GetErrMsg(code)
'''


# 成功状态码
SUCCSE=200

# 失败状态码
ERROR=500

# 参数：1001-1999
ERROR_PARAM_IS_INVALID   = 1001
ERROR_PARAM_IS_BLANK     = 1002
ERROR_PARAM_TYPE_BIND    = 1003
ERROR_PARAM_NOT_COMPLETE = 1004

# 用户： 2001-2009
ERROR_USERNAME_USED = 2001
ERROR_PASSWORD_WRONG = 2002
ERROR_USER_NOT_EXIST =2003
ERROR_TOKEN_EXIST = 2004
ERROR_TOKEN_RUNTTME = 2005
ERROR_TOKEN_WRONG = 2006
ERROR_TOKEN_TYPE_WRONG = 2007
ERROR_USER_NOT_RIGHT = 2008
ERROR_USER_ACCOUNT_FORBIDDEN=2009
ERROR_USER_NOT_LOGGED_IN=2010
USER_LOGGED_IN_OK = 2011
ERROR_USER_ALREADY_LOGGED_IN = 2012
ERROR_USER_AND_PASSWORD_WRONG=2013
USER_LOGOUT_OK=2014
USER_REGISTER_OK=2015
ERROR_USER_NOT_REGISTER=2016
USER_SELF_INFO_OK=2017
USER_EDIT_INFO_OK=2018
USER_SELF_INFO_DETAILED_OK=2019




# 博客
BLOG_INFO_EDIT_OK=3001


# 文章
ARTICLE_CREATE_OK = 4001
ERROR_ARTICLE_CREATE=4002
ARTICLE_CREATE_DATA_OK=4003
ARTICLE_DELETE_OK = 4004
ERROR_ARTICLE_DELETE=4005
ARTICLE_UPDATE_OK = 4006
ERROR_ARTICLE_UPDATE = 4007


# 分类
# Category
CATEGORY_CREATE_DATA_OK=5001
ERROR_CATEGORY_CREATE_DATA=5002
CATEGORY_GET_DATA_OK=5003
ERROR_CATEGORY_GET_DATA=5004
CATEGORY_DELTET_DATA_OK=5005
ERROR_CATEGORY_DELTET_DATA=5006
CATEGORY_UPDATE_DATA_OK = 5007
ERROR_CATEGORY_UPDATE_DATA = 5008

codeMsg = {
    SUCCSE:                 "OK",
	ERROR:                  "FAIL",

    ERROR_PARAM_IS_INVALID : "参数无效",
    ERROR_PARAM_IS_BLANK:    "参数为空",
    ERROR_PARAM_TYPE_BIND:   "参数类型错误",
    ERROR_PARAM_NOT_COMPLETE:"参数缺失",


	ERROR_USERNAME_USED:           	"用户名已存在",
	ERROR_PASSWORD_WRONG:          	"密码错误",
	ERROR_USER_NOT_EXIST:          	"用户名不存在",
	ERROR_TOKEN_EXIST:             	"token不存在",
	ERROR_TOKEN_RUNTTME:           	"token已过期",
	ERROR_TOKEN_WRONG:             	"token不正确",
	ERROR_TOKEN_TYPE_WRONG:        	"token格式错误",
	ERROR_USER_NOT_RIGHT:          	"用户无权限",
    ERROR_USER_ACCOUNT_FORBIDDEN:   "账号已被禁用",
    ERROR_USER_NOT_LOGGED_IN:       "用户未登录",
	USER_LOGGED_IN_OK:				"登录成功",
	ERROR_USER_ALREADY_LOGGED_IN:   "用户已登录，无需重新登录",
	ERROR_USER_AND_PASSWORD_WRONG: 	"用户名或者密码错误，请重新登录",
	USER_LOGOUT_OK:					"退出当前登录用户成功",
	USER_REGISTER_OK:				"注册成功",
	ERROR_USER_NOT_REGISTER:		"注册失败",
	USER_SELF_INFO_DETAILED_OK:		"获取用户详细信息成功",
	USER_SELF_INFO_OK:				"获取登录用户信息成功",
	USER_EDIT_INFO_OK:				"修改用户信息成功",
	BLOG_INFO_EDIT_OK:				"更新博客信息成功",
	ARTICLE_CREATE_OK:				"新建文章成功",
	ERROR_ARTICLE_CREATE:			"新建文章失败",
	ARTICLE_CREATE_DATA_OK:			"获取文章成功",
	ARTICLE_DELETE_OK:				"删除文章成功",
	ERROR_ARTICLE_DELETE:			"删除文章失败",
	ERROR_ARTICLE_UPDATE:			"更新文章失败",
	ARTICLE_UPDATE_OK:				"更新文章成功",
	CATEGORY_CREATE_DATA_OK:		"新建分类成功",
	ERROR_CATEGORY_CREATE_DATA:		"新建分类失败",
	CATEGORY_GET_DATA_OK: 			"获取分类成功",
	ERROR_CATEGORY_GET_DATA: 		"获取分类失败",
	CATEGORY_DELTET_DATA_OK: 		"删除分类成功",
	ERROR_CATEGORY_DELTET_DATA: 	"删除分类失败",
	CATEGORY_UPDATE_DATA_OK:		"更新分类成功",
	ERROR_CATEGORY_UPDATE_DATA:		"更新分类失败",




}

def GetErrMsg(code):
    return codeMsg[code]





